package nl.saxion.security.controller;

import java.io.File;

import com.adamtaft.eb.EventBusService;
import com.adamtaft.eb.EventHandler;
import com.google.inject.Inject;

import nl.saxion.security.config.Config;
import nl.saxion.security.config.INIConfig;
import nl.saxion.security.event.Event;
import nl.saxion.security.gui.GUI;
import nl.saxion.security.gui.elements.AbstractPathPanel;

public class FileController {
	

	
	@SuppressWarnings("unused")
	private GUI gui;
	
	@Inject
	public FileController(GUI g)
	{
		gui = g;
		
		EventBusService.subscribe(this);
	}
	
	@EventHandler
	public void handleEvent(Event event)
	{
		if(event.getEventName().equals(AbstractPathPanel.EVENT_CHOOSEN_FILE_CHANGED))
		{	
			File directory = (File) event.getArgument(AbstractPathPanel.ARGUMENT_CHOOSEN_FILE);
			Config config = new INIConfig();
			config.setAsString(Config.KEY_SYNC_PATH, directory.getAbsolutePath());
		}
	}
	
}
